/**
 * login模块接口列表
 */

import base from '@/common/base'; // 导入接口域名列表
import axios from '@/common/http'; // 导入http中创建的axios实例
import qs from 'qs'; // 根据需求是否导入qs模块

const index = {
    // 汽车详情
    detail(id) {
        return axios({
            method: 'get',
            url: `${base.sq}Info/details`,
            params: {id: id},
            headers: {'user': 1}
        });
    },

    // 留言列表
    msg(id, page) {
        return axios({
            method: 'get',
            url: `${base.sq}Info/message`,
            params: {id: id, page: page},
            headers: {'user': 1,'load':1}
        });
    },

    // 留言点赞
    msgGood(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Info/goodMsg`,
            data: qs.stringify(params),
            headers: {'load':1}
        });
    },

    // 汽车点赞
    carGood(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Info/carGood`,
            data: qs.stringify(params),
            headers: {'load':1}
        });
    },

    // 留言
    carMsg(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Info/carMsg`,
            data: qs.stringify(params)
        });
    },

    // 用户浏览记录
    carHistory() {
        return axios({
            method: 'post',
            url: `${base.sq}Info/getUserHistory`
        });
    },

    //用户收藏
    userCollect(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Info/userCollect`,
            data: qs.stringify(params),
            headers:{'load':1}
        });
    },

    //汽车加装配置
    getLable() {
        return axios({
            method: 'post',
            url: `${base.sq}Sell/getCarLabel`,
            data: [],
            headers: {'user': 1,'load':1}
        });
    },

    /**
     * 获取品牌
     */
    getBrand(key = "") {
        return axios({
            method: 'get',
            url: `${base.sq}Info/carBrand`,
            params: {keyword: key},
            headers: {'user': 1}
        });
    },

    /**
     * 获取车系
     * @param params
     */
    getSeries(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Info/carSeries`,
            data: qs.stringify(params),
            headers: {'user': 1}
        });
    },

    /**
     * 获取车
     * @param params
     */
    getCar(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Info/getCar`,
            data: qs.stringify(params),
            headers: {'user': 1}
        });
    },

    //汽车发布
    userAddCar(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Sell/publish`,
            data: qs.stringify(params)
        });
    },

    /**
     * 汽车列表
     * @param params
     */
    getCarList(params) {
        return axios({
            method: 'get',
            url: `${base.sq}Info/index`,
            params: params,
            headers: {'user': 1,'load':1}
        });
    },

    /**
     * 留言未读统计
     * @param params
     */
    getMsgCount() {
        return axios({
            method: 'get',
            url: `${base.sq}Info/msgCount`,
            headers: {'user': 1}
        });
    },

    /**
     * PK数据
     * @param params
     */
    getPkList(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Info/getPkData`,
            data: qs.stringify(params),
            headers: {'user': 1}
        });
    },

    /**
     * PK数据
     * @param params
     */
    getMiniTool(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Info/getPkMini`,
            data: qs.stringify(params),
            headers: {'user': 1}
        });
    },

    searchCarKeyword(Keyword, page = 1) {
        return axios({
            method: 'get',
            url: `${base.sq}Info/searchCarKeyword`,
            params: {keyword: Keyword, page: page},
            headers: {'user': 1}
        });
    },

    getPushCarInfo(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Sell/getPublishInfo`,
            data: qs.stringify(params)
        });
    },

    getCarCard(params) {
        return axios({
            method: 'post',
            url: `${base.sq}Sell/carCard`,
            data: qs.stringify(params)
        });
    },
}

export default index;
